<?php

/***************************************
 * functions to use the settings
 ***************************************/

// GENERAL

function simpax_styleswitcher() {
	global $simpax;
	if ($simpax->option['styleswitcher'] == 'yes') return true;
	else return false;
}

function simpax_is_style() {
	global $simpax;
	if ($simpax->option['use_style']) return true;
	else return false;
}

function simpax_use_style() {
	global $simpax;
	if ($simpax->option['use_style']) {
		$cur_style = $simpax->option["use_style"];
		$cur_style_dir = preg_replace('<.css>', '', $simpax->option["use_style"]);
		echo '<link rel="stylesheet" href="'.get_bloginfo('stylesheet_directory').'/styles/'.$cur_style_dir.'/'.$cur_style.'" type="text/css"  id="the_stylsheet" />';
	} else { return false; }
}

function simpax_header_img() {
	global $simpax;
	if ($simpax->option['header_img'] == 'yes') return true;
	else return false;
}

function simpax_is_title_img() {
	global $simpax;
	if ($simpax->option['title_img']) return true;
	else return false;
}

function simpax_title_img() {
	global $simpax;
	if ($simpax->option['title_img']) echo $simpax->option['title_img'];
	else echo '';
}

function simpax_title_img_center() {
	global $simpax;
	if (!$simpax->option['title_img_center'] == '') return true;
	else return false;
}

function simpax_title_img_x() {
	global $simpax;
	if ($simpax->option['title_img_x']) echo $simpax->option['title_img_x'];
	else echo '';
}

function simpax_title_img_y() {
	global $simpax;
	if ($simpax->option['title_img_y']) echo $simpax->option['title_img_y'];
	else echo '';
}

function simpax_styles_showcase() {
	global $simpax;
	if (!$simpax->option['styles_showcase'] == '') return true;
	else return false;
}

function simpax_bottombar() {
	global $simpax;
	if ($simpax->option['bottombar'] == 'yes') :
		if(! (is_single() or is_page()) ) { return true; }
		elseif($simpax->option['bottombar_single'] == 'yes') { return true; }
		else { return false; }
	endif;
}

function simpax_sidebar_single() {
	global $simpax;
	if (!$simpax->option['sidebar_single'] == '') return true;
	else return false;
}

function simpax_sidebar() {
	global $simpax;
	if (!$simpax->option['sidebar'] == '') :
		if( !(is_single() or is_page()) or simpax_sidebar_single() ) :
			if ($simpax->option['sidebar'] == 'left') : return "left";
			elseif ($simpax->option['sidebar'] == 'right'): return "right";
			elseif ($simpax->option['sidebar'] == 'right_connected'): return "right_connected";
			else: return false;
			endif;
		endif;
	else : return false;
	endif;
}

function simpax_is_sidebar_img() {
	global $simpax;
	if ($simpax->option['sidebar_img']) return true;
	else return false;
}

function simpax_sidebar_img() {
	global $simpax;
	if ($simpax->option['sidebar_img']) echo $simpax->option['sidebar_img'];
	else echo '';
}

function simpax_ext_links() {
	global $simpax;
	if ($simpax->option['ext_links'] == 'yes') return true;
	else return false;
}

function simpax_is_cax_spam() {
	global $simpax;
	if ($simpax->option['cax_spam'] !== 'none' && $simpax->option['cax_spam'] !== '') return true;
	else return false;
}

function simpax_cax_spam() {
	global $simpax;
	if ($simpax->option['cax_spam'] !== '') echo $simpax->option['cax_spam'];
	else echo '';
}

function simpax_is_zooomr_lightbox() {
	global $simpax;
	if ($simpax->option['zooomr_lightbox'] == 'yes') return true;
	else return false;
}

function simpax_is_livesearch() {
	global $simpax;
	if ($simpax->option['livesearch'] == 'yes') return true;
	else return false;
}

function simpax_livesearch_num_results() {
	global $simpax;
	if ($simpax->option['livesearch_num_results'] !== '') return $simpax->option['livesearch_num_results'];
	else return false;
}

function simpax_livesearch_show_date() {
	global $simpax;
	if ($simpax->option['livesearch_show_date'] == 'yes') return true;
	else return false;
}

function simpax_livesearch_show_comments() {
	global $simpax;
	if ($simpax->option['livesearch_show_comments'] == 'yes') return true;
	else return false;
}

function simpax_livesearch_show_desc() {
	global $simpax;
	if ($simpax->option['livesearch_show_desc'] == 'yes') return true;
	else return false;
}

// HOME

function simpax_feedicon() {
	global $simpax;
	if ($simpax->option['feedicon'] == 'yes') return true;
	else return false;
}

function simpax_excerpt() {
	global $simpax;
	if ($simpax->option['excerpt'] == 'yes') return true;
	else return false;
}

function simpax_greetings() {
	global $simpax;
	if ($simpax->option['greetings'] == 'yes') return true;
	else return false;
}

function simpax_date() {
	global $simpax;
	if ($simpax->option['date'] == 'top') return "top";
	elseif ($simpax->option['date'] == 'right') return "right";
	elseif ($simpax->option['date'] == 'bottom') return "bottom";
	else return "none";
}

function simpax_cmt_number() {
	global $simpax;
	if ($simpax->option['cmt_number'] == 'yes') return true;
	else return false;
}

function simpax_editlink() {
	global $simpax;
	if ($simpax->option['editlink'] == 'yes') return true;
	else return false;
}

function simpax_date_icons() {
	global $simpax;
	if ($simpax->option['date_icons'] == 'yes') return true;
	else return false;
}

function simpax_show_author() {
	global $simpax;
	if ($simpax->option['show_author'] == 'yes') return true;
	else return false;
}

function simpax_is_trenn() {
	global $simpax;
	if ($simpax->option['trenn']) return true;
	else return false;
}

function simpax_hilight_news() {
	global $simpax;
	if ($simpax->option['hilight_news']) return true;
	else return false;
}

function simpax_trenn() {
	global $simpax;
	if ($simpax->option['trenn']) echo $simpax->option['trenn'];
	else echo '';
}

function simpax_asides() {
	global $simpax;
	if($simpax->option['asides']) return true;
	else return false;
}

function simpax_get_asides_cat() {
	global $simpax;
	if($simpax->option['asides']) echo $simpax->option['asides'];
	else echo '';
}

function simpax_is_asides() {
	global $simpax;
	$categories = array ();
	/* get all categories for the post we are processing */
	foreach((get_the_category()) as $cat) {
		$categories[] = $cat->cat_name;
	}
	/* is one of these categories the same as our Asides cat ? */
	if (in_array($simpax->option['asides'],$categories)) {
		return true;
	} else {
		return false;
	}
}

function simpax_pagelist() {
	global $simpax;
	if ($simpax->option['pagelist'] == 'yes') return true;
	else return false;
}

// SINGLE

/*
function simpax_is_ranvatar() {
	global $simpax;
	if ($simpax->option['ranvatar'] !== 'none' && $simpax->option['ranvatar'] !== '') return true;
	else return false;
}

function simpax_ranvatar() {
	global $simpax;
	if(simpax_ranvatar()) :
		if ($simpax->option['ranvatar']) : echo $simpax->option['ranvatar'];
		else : echo '';
		endif;
	endif;
}
*/

function simpax_authorcmt() {
	global $simpax;
	if ($simpax->option['authorcmt'] == 'yes') return true;
	else return false;
}

function simpax_ajaxcmt() {
	global $simpax;
	if ($simpax->option['ajaxcmt'] == 'yes') return true;
	else return false;
}

function simpax_authorcmt_img() {
	global $simpax;
	if ($simpax->option['authorcmt_img']) echo $simpax->option['authorcmt_img'];
	else echo '';
}

function simpax_gravatars() {
	global $simpax;
	if ($simpax->option['gravatars'] == 'yes') return true;
	else return false;
}

function simpax_gravatars_default_img() {
	global $simpax;
	if ($simpax->option['gravatars_default_img']) return $simpax->option['gravatars_default_img'];
	else return '';
}

function simpax_gravatars_size() {
	global $simpax;
	if($simpax->option['gravatars_size']) {
		if ($simpax->option['gravatars_size'] > 48) {
			return '48';
		} else { 
			return $simpax->option['gravatars_size'];
		}
	} else {
		return '32';
	}
}

function simpax_cmt_info() {
	global $simpax;
	if ($simpax->option['cmt_info'] == 'yes') return true;
	else return false;
}

function simpax_cmt_info_mini() {
	global $simpax;
	if ($simpax->option['cmt_info_mini'] == 'yes') return true;
	else return false;
}

function simpax_avatar_pos() {
	global $simpax;
	if ($simpax->option['avatar_pos'] == 'yes') return true;
	else return false;
}

// Archive

function simpax_is_archive() {
	global $simpax;
	$archive_id = $simpax->option['archive_id'];
	if(	is_page("$archive_id") ) return true;
	else return false;
}

function simpax_archive_toc() {
	global $simpax;
	if ($simpax->option['archive_toc'] == 'yes') return true;
	else return false;
}

function simpax_archive_links() {
	global $simpax;
	if ($simpax->option['archive_links'] == 'yes') return true;
	else return false;
}

function simpax_archive_cats() {
	global $simpax;
	if ($simpax->option['archive_cats'] == 'yes') return true;
	else return false;
}

function simpax_archive_months() {
	global $simpax;
	if ($simpax->option['archive_months'] == 'yes') return true;
	else return false;
}

function simpax_archive_posts() {
	global $simpax;
	if ($simpax->option['archive_posts'] == 'yes') : return true;
	else: return false;
	endif;
}

function simpax_archive_timeline() {
	global $simpax;
	if ($simpax->option['archive_timeline'] == 'yes') return true;
	else return false;
}

// TODO LIST

function simpax_is_todo() {
	global $simpax;
	$categories = array ();
	/* get all categories for the post we are processing */
	foreach((get_the_category()) as $cat) {
		$categories[] = $cat->cat_name;
	}
	/* is one of these categories the same as our Asides cat ? */
	if (in_array($simpax->option['todo_cat'],$categories)) {
		return true;
	} else {
		return false;
	}
}

function simpax_todo_cat() {
	global $simpax;
	if($simpax->option['todo_cat']) return $simpax->option['todo_cat'];
	else echo '';
}

function simpax_todo_cat_new() {
	global $simpax;
	if($simpax->option['todo_cat_new']) return $simpax->option['todo_cat_new'];
	else echo '';
}

function simpax_todo_cat_working() {
	global $simpax;
	if($simpax->option['todo_cat_working']) return $simpax->option['todo_cat_working'];
	else echo '';
}

function simpax_todo_cat_fixed() {
	global $simpax;
	if($simpax->option['todo_cat_fixed']) return $simpax->option['todo_cat_fixed'];
	else echo '';
}

// FOOTER

function simpax_countercode() {
	global $simpax;
	if ($simpax->option['countercode']) echo $simpax->option['countercode'];
	else echo '';
}

function simpax_footer_buttons() {
	global $simpax;
	if ($simpax->option['footer_text'] == "buttons") return true;
	else return false;
}

function simpax_footer_buttons_own() {
	global $simpax;
	if ($simpax->option['footer_buttons_own']) echo $simpax->option['footer_buttons_own'];
	else echo '';
}

// ADSENSE

function simpax_amazon_links() {
	global $simpax;
	if ($simpax->option['amazon_links'] == 'yes') return true;
	else false;
}

function simpax_amazon_id() {
	global $simpax;
	if ($simpax->option['amazon_id']) echo $simpax->option['amazon_id'];
	else echo '';
}

function simpax_adsense() {
	global $simpax;
	if ($simpax->option['adsense']) echo $simpax->option['adsense'];
	else echo '';
}

function simpax_ads_safety() {
	global $simpax;
	if ($simpax->option['ads_safety'] == 'yes') return true;
	else return false;
}

function simpax_ads_468x15() {
	global $simpax;
	if ($simpax->option['ads_468x15']) echo $simpax->option['ads_468x15'];
	else echo '';
}

function simpax_ads_468x60() {
	global $simpax;
	if ($simpax->option['ads_468x60']) echo $simpax->option['ads_468x60'];
	else echo '';
}

function simpax_ads_160x600() {
	global $simpax;
	if ($simpax->option['ads_160x600']) echo $simpax->option['ads_160x600'];
	else echo '';
}

function simpax_ads_180x150() {
	global $simpax;
	if ($simpax->option['ads_180x150']) echo $simpax->option['ads_180x150'];
	else echo '';
}

// EFFECTS

function simpax_accordion() {
	global $simpax;
	if ($simpax->option['accordion'] == 'yes') return true;
	else return false;
}

function simpax_nicetitle() {
	global $simpax;
	if ($simpax->option['nicetitle'] == 'yes') return true;
	else return false;
}

function simpax_lightbox() {
	global $simpax;
	if ($simpax->option['lightbox'] == 'lightbox1') return "one";
	elseif ($simpax->option['lightbox'] == 'slimbox') return "slim";
	elseif ($simpax->option['lightbox'] == 'thick') return "thick";
	else return false;
}

function simpax_slide() {
	global $simpax;
	if ($simpax->option['slide'] == 'yes') return true;
	else return false;
}

function simpax_editable() {
	global $simpax;
	if ($simpax->option['editable'] == 'yes') return true;
	else return false;
}

function simpax_hide_cmts() {
	global $simpax;
	if ($simpax->option['hide_cmts'] == 'yes') return true;
	else return false;
}


?>